from selenium.webdriver.common.by import By
import time
from base_page import BasePage


class RegisterPageLocators:
    # Locators
    REGISTER_BUTTON = (By.CSS_SELECTOR, "button[type='submit']")
    USERNAME_INPUT = (By.CSS_SELECTOR, "#username")
    PASSWORD_INPUT = (By.CSS_SELECTOR, "#password")


class RegisterPage(BasePage):

    URL = "https://swtesting-class-demo.koyeb.app/login"

    def open(self):
        self.visit(self.URL)

    def submit(self):
        self.click(RegisterPageLocators.REGISTER_BUTTON)

    def fill_register_form(self, username, password):
        self._input(RegisterPageLocators.USERNAME_INPUT, username)
        self._input(RegisterPageLocators.PASSWORD_INPUT, password)
